<template>
  <div>
    <el-form :model="householdForm" ref="householdForm">
      <el-form-item label="姓名">
        <el-input v-model="householdForm.name"></el-input>
      </el-form-item>
      <el-form-item label="住址">
        <el-input v-model="householdForm.address"></el-input>
      </el-form-item>
      <el-form-item label="手机号码">
        <el-input v-model="householdForm.phone"></el-input>
      </el-form-item>
      <el-form-item label="身份证">
        <el-input v-model="householdForm.idCard"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="handleSubmit">提交</el-button>
        <el-button @click="handleCancel">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      householdForm: {
        name: '',
        address: '',
        phone: '',
        idCard: ''
      }
    }
  },
  methods: {
    handleSubmit() {
      // 提交表单数据
      this.$http.post('/household/add', this.householdForm).then(() => {
        this.$router.push('/household/list');
      });
    },
    handleCancel() {
      // 取消表单操作
      this.$router.push('/household/list');
    }
  }
}
</script>

<style scoped>

</style>